home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / os2 / cutv10.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1993-12-27  |  2KB  |  69 lines

  1. /* REXX - Installation */
  2. parse arg path
  3. Signal on Halt
  4. name = 'CutIt'
  5. files.0 = 2; files.1 = 'cutit.exe'; files.2 = 'cutit.ico'
  6. exe = 1
  7. note = '0d0a'x ,
  8.  'This program requires the runtime module VROBJ.DLL from WATCOM''s VX-REXX.' ,
  9.  '0d0a'x ,
  10.  'It must be located in a directory in the LIBPATH config.sys entry.' ,
  11.  ''
  12.  
  13. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  14. call SysLoadFuncs
  15.  
  16. if path = '' then do
  17.   ret = SysIni('SYSTEM', 'FolderWorkareaRunningObjects', 'ALL:', 'Desktop')
  18.   if ret <> '' | Desktop.0 <> 1 then do                                    
  19.     say 'Error locating Desktop, C:\cutit will be used as a default'
  20.     path = 'C:\' || name
  21.   end
  22.   else path = left(Desktop.1, 3) || name
  23. end
  24.  
  25. r = 0
  26. p = ''
  27. do until p = ''
  28. say path
  29.   if SysFileTree(path, 'dir.', 'DO') then do
  30.     say '*** Error ***'
  31.     r = 99
  32.   end
  33.   if dir.0 > 0 then
  34.     msg = 'EXISTS.'
  35.   else msg = 'will be CREATED.'
  36.   say name 'will be installed in' translate(path) || '. The directory' msg
  37.   say 'Press <Enter> to accept, <Ctrl-C><Enter> to cancel or type a new directory path'
  38.   p = strip(linein())
  39.   if p <> '' then path = p
  40. end
  41.  
  42. path = strip(path, 'T', '\')
  43. if dir.0 = 0 then do
  44.   '@md 1>nul 2>nul' path
  45.   if rc <> 0 then do
  46.     say '*** ERROR *** Could not create directory' path
  47.     r = 99
  48.   end
  49. end
  50.  
  51. if directory() <> path then
  52.   do i = 1 to files.0
  53.     '@copy' files.i path
  54.   end
  55.  
  56. setup = 'EXENAME=' || path || '\' || files.exe || ';STARTUPDIR=' || path
  57. if SysCreateObject('WPProgram', name, '<WP_DESKTOP>', setup, 'F') then
  58.   say name 'has been created on your DESKTOP.'
  59. else do
  60.  say 'The program object' name 'could not be created, possible duplicate'
  61.  r = 99
  62. end
  63.  
  64. if r = 0 then say note
  65. '@pause'
  66. return r
  67. halt:
  68. say 'Cancelled'
  69.